<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="vue.js" type="text/javascript" charset="utf-8"></script>
    <style>
       
    </style>
</head>
<body>
    <div id="app">

        <input type="button" value="点击" @click="setM">
       <input type="text" v-model="msg" @keyup.enter="getM">
       <h2>{{msg}}</h2>

    </div>
    <script> 
        //获取和设置表单元素的值(双向数据绑定 ).
        //绑定的数据会跟表单元素的值相关联 
        //绑定的数据     对应表单元素的值
        //v-model 指令 的作用是编写的设置和获取表单元素的值
        var app= new Vue({ 
            el:"#app",
            data:{
              msg:"黑马程序员" 
            },
            methods: {
              getM:function(){
                  alert(this.msg);
              },
              setM:function(){
                  this.msg="酷丁鱼";
              }
            }, 
        });

    </script>
</body>
</html>